package main

import (
	"fmt"

	"github.com/apache/arrow/go/v6/arrow"
	"github.com/apache/arrow/go/v6/arrow/array"
	"github.com/apache/arrow/go/v6/arrow/math"
	"github.com/apache/arrow/go/v6/arrow/memory"
)

func readArrowFile() {
	schema := arrow.NewSchema(
		[]arrow.Field{
			arrow.Field{Name: "a", Type: arrow.PrimitiveTypes.Int64, Nullable: true},
			arrow.Field{Name: "b", Type: arrow.PrimitiveTypes.Int64, Nullable: true},
		}, nil,
	)
	mem := memory.NewCheckedAllocator(memory.NewGoAllocator())

	_ = schema
	_ = mem
}

func main() {
	println("------------------arrow go------------------")

	fb := array.NewFloat64Builder(memory.DefaultAllocator)

	fb.AppendValues([]float64{1, 3, 5, 7, 9, 11}, nil)

	vec := fb.NewFloat64Array()

	for _, val := range vec.Float64Values() {
		fmt.Printf("%f\t", val)
	}

	fmt.Printf("\n--------------------------------------------------------------------------------------------\n")

	sum := math.Float64.Sum(vec)

	fmt.Printf("sum = %f\n", sum)
}
